home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / security / xinetd / xinetd.2.0.6 / int.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-22  |  1.7 KB  |  94 lines

  1. /*
  2.  * (c) Copyright 1992 by Panagiotis Tsirigotis
  3.  * All rights reserved.  The file named COPYRIGHT specifies the terms 
  4.  * and conditions for redistribution.
  5.  */
  6.  
  7. #ifndef INT_H
  8. #define INT_H
  9.  
  10. /*
  11.  * $Id: int.h,v 5.1 1992/10/31 23:59:07 panos Exp $
  12.  */
  13.  
  14. #include <sys/types.h>
  15. #include <netinet/in.h>
  16.  
  17. #include "fsma.h"
  18. #include "pset.h"
  19.  
  20. #include "server.h"
  21.  
  22. struct intercept_stream
  23. {
  24.     unsigned accepted_channels ;
  25. } ;
  26.  
  27.  
  28. struct intercept_dgram
  29. {
  30.     unsigned received_packets ;
  31. } ;
  32.  
  33.  
  34. typedef enum { GOOD_CHANNEL, BAD_CHANNEL } channel_state_e ;
  35.  
  36. struct channel
  37. {
  38.     channel_state_e state ;
  39.     struct sockaddr_in from ;
  40.     int local_socket ;
  41.     int remote_socket ;
  42. } ;
  43.  
  44. typedef struct channel channel_s ;
  45.  
  46. #define CHP( p )                  ((struct channel *)(p))
  47.  
  48. channel_s *int_lookupconn() ;
  49. channel_s *int_newconn() ;
  50.  
  51.  
  52. struct intercept_common
  53. {
  54.     bool_int intercept ;
  55.     int remote_socket ;
  56.     struct sockaddr_in local_addr ;
  57.     pset_h connections ;
  58.     fsma_h channel_allocator ;
  59.     struct server server ;
  60. } ;
  61.  
  62.  
  63. struct intercept_ops
  64. {
  65.     void (*mux)() ;
  66.     void (*exit)() ;
  67. } ;
  68.  
  69.  
  70. struct intercept
  71. {
  72.     int socket_type ;
  73.     struct intercept_common common ;
  74.     void *priv ;
  75.     struct intercept_ops *ops ;
  76. } ;
  77.  
  78. #define INT_TYPE( p )                    ((p)->socket_type)
  79. #define INT_SERVER( p )                    (&(p)->common.server)
  80. #define INT_LOCALADDR( p )                (&(p)->common.local_addr)
  81. #define INT_REMOTE( p )                    ((p)->common.remote_socket)
  82. #define INT_ALLOCATOR( p )                ((p)->common.channel_allocator)
  83. #define INT_CONNECTIONS( p )            ((p)->common.connections)
  84. #define INTERCEPT( p )                    ((p)->common.intercept)
  85.  
  86. void int_fail() ;
  87. int int_select() ;
  88. void int_exit() ;
  89. void int_init() ;
  90. channel_s *int_newconn() ;
  91. channel_s *int_lookupconn() ;
  92.  
  93. #endif    /* INT_H */
  94.